package prg;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;


public class MainComposite extends Composite
{

    private Group group1 = null;
    private Group group2 = null;
    private Group group3 = null;
    private Text text = null;
    private Button button = null;
    private Label label1 = null;
    private Label label = null;
    private Text text1 = null;


    public MainComposite( Composite parent, int style )
    {
        super( parent, style );
        initialize();
    }


    private void initialize()
    {
        createGroup1();
        this.setLayout( new GridLayout() );
        createGroup2();
        createGroup3();
        setSize( new Point( 300, 200 ) );
    }


    /**
     * This method initializes group1
     */
    private void createGroup1()
    {
        GridData gridData7 = new GridData();
        gridData7.horizontalAlignment = GridData.CENTER;
        gridData7.widthHint = 130;
        gridData7.verticalAlignment = GridData.CENTER;
        GridData gridData2 = new GridData();
        gridData2.horizontalAlignment = GridData.FILL;
        gridData2.grabExcessHorizontalSpace = true;
        gridData2.verticalAlignment = GridData.CENTER;
        GridData gridData1 = new GridData();
        gridData1.horizontalAlignment = GridData.FILL;
        gridData1.grabExcessHorizontalSpace = true;
        gridData1.grabExcessVerticalSpace = false;
        gridData1.verticalAlignment = GridData.CENTER;
        GridData gridData = new GridData();
        gridData.grabExcessVerticalSpace = false;
        gridData.verticalAlignment = GridData.CENTER;
        gridData.heightHint = 23;
        gridData.horizontalAlignment = GridData.BEGINNING;
        GridLayout gridLayout = new GridLayout();
        gridLayout.numColumns = 3;
        group1 = new Group( this, SWT.NONE );
        group1.setText( "Input" );
        group1.setLayoutData( gridData2 );
        group1.setLayout( gridLayout );
        label1 = new Label( group1, SWT.NONE );
        label1.setText( "Expression : " );
        label1.setLayoutData( gridData7 );
        text = new Text( group1, SWT.BORDER );
        text.setLayoutData( gridData1 );
        button = new Button( group1, SWT.NONE );
        button.setText( "&Evaulate" );
        button.setLayoutData( gridData );
    }


    /**
     * This method initializes group2
     */
    private void createGroup2()
    {
        GridData gridData6 = new GridData();
        gridData6.horizontalAlignment = GridData.END;
        gridData6.widthHint = 130;
        gridData6.verticalAlignment = GridData.CENTER;
        GridData gridData5 = new GridData();
        gridData5.horizontalAlignment = GridData.FILL;
        gridData5.grabExcessHorizontalSpace = true;
        gridData5.grabExcessVerticalSpace = false;
        gridData5.verticalAlignment = GridData.CENTER;
        GridLayout gridLayout1 = new GridLayout();
        gridLayout1.numColumns = 2;
        GridData gridData3 = new GridData();
        gridData3.horizontalAlignment = GridData.FILL;
        gridData3.grabExcessHorizontalSpace = true;
        gridData3.verticalAlignment = GridData.CENTER;
        group2 = new Group( this, SWT.NONE );
        group2.setLayoutData( gridData3 );
        group2.setLayout( gridLayout1 );
        group2.setText( "Postfix" );
        label = new Label( group2, SWT.NONE );
        label.setText( "Postfix Expression :" );
        label.setLayoutData( gridData6 );
        text1 = new Text( group2, SWT.BORDER );
        text1.setLayoutData( gridData5 );
    }


    /**
     * This method initializes group3
     */
    private void createGroup3()
    {
        GridData gridData4 = new GridData();
        gridData4.horizontalAlignment = GridData.FILL;
        gridData4.grabExcessHorizontalSpace = true;
        gridData4.verticalAlignment = GridData.CENTER;
        group3 = new Group( this, SWT.NONE );
        group3.setLayout( new GridLayout() );
        group3.setLayoutData( gridData4 );
    }


    public Button getButtonEvaluate()
    {
        return button;
    }


    public String getInputString()
    {
        return text.getText().trim();
    }

}
